//Main.cc
#include"ThreadPool.hpp"
#include"Task.hpp"
#include"Log.hpp"
#include<memory>

using std::cin;
using std::cout;
using std::endl;
using namespace log_ns;

int main()
{

    EnableScreen();

    //ThreadPool<Task> tp=*(ThreadPool<Task>::GetInstance());

    //std::unique_ptr<ThreadPool> tp=std::make_unique<>();  //构建一个ThreadPool对象
    // ThreadPool<Task> *tp=new ThreadPool<Task>();
    
    // tp->Init();

    // tp->Start();

    int cnt=10;
    while (cnt)
    {
        // 不断地向线程池推送任务
        sleep(1);
        Task t(1,1);
        ThreadPool<Task>::GetInstance()->Equeue(t);
        LOG(INFO,"equeue a task, %s\n",t.debug().c_str());
        sleep(1);
    }
    ThreadPool<Task>::GetInstance()->Stop();
    LOG(INFO,"thread pool stop!\n");
    sleep(10);

    return 0;
}